t Application Builder: Life in the Fast and Easy Lane
Compare this low-level approach with Prograph’s object-oriented capabilities utilizing Application Builder.
u Open the System Classes file to gain access to the collection of Prograph classes that describe the foundation objects making up a Macintosh application. (You can save your current work in a temporary file if you wish, or simply discard it as you open the System Classes file.) Select Edit Application from the Exec menu.
u When the*43* Application editor*297* opens, type Test Windows in the Name field. Then double-click the word Window in the Classes scrolling list to create a new Window instance. Double-click the title of the instance, Untitled, in the List of Instances scrolling list to open your new window.
u Option-command-double-click the Untitled window to bring up the Window editor dialog and type NewWin in the Window Title field and make sure that /Close is in the Close Method field (to call the supplied Close method in the Window class). Click the Zoom Box check box item to indicate that you want your window to have a zoom control in addition to its default grow and close boxes.
u Click the OK button or press Return to dismiss the Window editor and return to the NewWin window.
 
u Click the close box of the NewWin window to dismiss the window and return to the Application editor.
u Click Add To Active List and press OK to dismiss the Application editor.
u Select Run initial from the Exec menu to see your handiwork. Zoom, resize, move, and then click the close box of the resulting NewWin window.
u Closing the window puts NewWin out of sight, but your application’s event loop is still running. To quit your application and get back to the Prograph editors, select Quit from the File menu. Alternatively, press Command-= followed by Command-R, first to switch context, and then to stop running your application.
Application Builder, with its base System classes and built-in*324* event-loop processing, gives you automatic access and responsiveness to typical user interactions. Sure, it is helpful the more you know about the inner workings of the Macintosh, but such intimate knowledge is not a prerequisite or requirement for making immediate, functional use of Prograph.
In fact, if you have gone through the Grand Tour chapters and created the Folks Database mini-application, you have already done a decent amount of sophisticated Macintosh programming. If you are already a Macintosh programmer, you know how easy it is to create Folks Database in Prograph compared to writing this same application in Pascal, Basic, Lisp, C, or HyperCard. If you are new to Mac programming, you may not yet have such explicit understanding. But, suffice to say, the more you get to know and understand Application Builder, the more you won’t want to program without it.
t Prograph System Classes and Application Builder Editors
“So what is going on here?,” you might be asking yourself. “Is it all being done with smoke and mirrors? What am I giving up by turning control over to Application Builder?” The answers are “A lot,” “No,” and “Nothing.”
*927*A more complete explanation is that the Prograph System classes and Application Builder add a natural layer of object-oriented definition and control around the machine level of the Macintosh. This is done by Prograph supplying a core of system-defined classes that describe the complex data structures of the Macintosh interface—the windows, menus, menu items, and the multitude of items that can appear in windows.
 
As you saw earlier in this tutorial, you do not lose control or capabilities using Application Builder because you always have the option of dropping down to the do-it-yourself level if you find any situation in which you feel Prograph’s built-in capabilities are not exactly what you need. (We believe, though, that you will not find too many circumstances in which Application Builder cannot handle all your application-development needs.)
Application Builder sounds like a potent prescription for Macintosh programming productivity. But what about the hacker mentality that says, “Real programmers don’t use toolkits!”
Well, there was a time too when Indy 500 race-car drivers made jokes about peers driving Formula 1 autos with automatic transmissions. These same folks now routinely use the newer technology, or else they’d be choking on exhaust from their peers out in front. The same will most likely occur with the productivity tools showcased in Prograph’s integrated environment.
Prograph’s System classes*921* are generally complex data structures—collections of attributes—with a few system-supplied methods. Some object-oriented environments, like Smalltalk, supply a large hierarchy of system classes and a large number of predefined methods. But implementing OOP on the Macintosh is generally different. The Mac’s ROM*952* Toolbox and other operating-system facilities provide a built-in capability to do much of what is performed in such systems as Smalltalk. So there is less of a need for mountains of language-specific source-code methods.
The combination of Prograph’s own powerful primitives coupled with the Macintosh’s own Toolbox and related capabilities provide a tremendous amount of functionality compared to other systems’ supplied methods. To make the Macintosh programmable, data structures are the name of the game. That is why the Prograph System classes are heavy on the attribute side and light on the methods side.
To better understand Prograph’s System classes and their specialized Application Builder editors, and to understand how these things relate to a Prograph application, take a few minutes to explore the current state of the environment. Have you wondered where that NewWin window is in relation to the Prograph environment and how it is accessed within the context of running your application?